<script>on mouseUpif there is a stack "Phone Dialer"then dialNumber bg fld id 102else dial bg fld id 102end mouseUp</script>
</part>
<part>
<id>65</id>
<type>button</type>
<visible> <true /> </visible>
<reserved5> 0 </reserved5>
<reserved4> 0 </reserved4>
<reserved3> 0 </reserved3>
<reserved2> 0 </reserved2>
<reserved1> 0 </reserved1>
<enabled> <true /> </enabled>
<rect>
<left>99</left>
<top>211</top>
<right>116</right>
<bottom>228</bottom>
</rect>
<style>transparent</style>
<showName> <false /> </showName>
<highlight> <false /> </highlight>
<autoHighlight> <false /> </autoHighlight>
<sharedHighlight> <true /> </sharedHighlight>
<family>0</family>
<titleWidth>0</titleWidth>
<icon>23613</icon>
<textAlign>right</textAlign>
<font>Geneva</font>
<textSize>9</textSize>
<textStyle>plain</textStyle>
<name>Phone Number 3</name>
<script>on mouseUpif there is a stack "Phone Dialer"then dialNumber bg fld id 101else dial bg fld id 101end mouseUp</script>
</part>
<part>
<id>39</id>
<type>button</type>
<visible> <true /> </visible>
<reserved5> 0 </reserved5>
<reserved4> 0 </reserved4>
<reserved3> 0 </reserved3>
<reserved2> 0 </reserved2>
<reserved1> 0 </reserved1>
<enabled> <true /> </enabled>
<rect>
<left>99</left>
<top>195</top>
<right>116</right>
<bottom>212</bottom>
</rect>
<style>transparent</style>
<showName> <false /> </showName>
<highlight> <false /> </highlight>
<autoHighlight> <false /> </autoHighlight>
<sharedHighlight> <true /> </sharedHighlight>
<family>0</family>
<titleWidth>0</titleWidth>
<icon>23613</icon>
<textAlign>right</textAlign>
<font>Geneva</font>
<textSize>9</textSize>
<textStyle>plain</textStyle>
<name>Phone Number 2</name>
<script>on mouseUpif there is a stack "Phone Dialer"then dialNumber bg fld id 100else dial bg fld id 100end mouseUp</script>
</part>
<part>
<id>21</id>
<type>button</type>
<visible> <true /> </visible>
<reserved5> 0 </reserved5>
<reserved4> 0 </reserved4>
<reserved3> 0 </reserved3>
<reserved2> 0 </reserved2>
<reserved1> 0 </reserved1>
<enabled> <true /> </enabled>
<rect>
<left>99</left>
<top>179</top>
<right>116</right>
<bottom>195</bottom>
</rect>
<style>transparent</style>
<showName> <false /> </showName>
<highlight> <false /> </highlight>
<autoHighlight> <false /> </autoHighlight>
<sharedHighlight> <true /> </sharedHighlight>
<family>0</family>
<titleWidth>0</titleWidth>
<icon>23613</icon>
<textAlign>right</textAlign>
<font>Geneva</font>
<textSize>9</textSize>
<textStyle>plain</textStyle>
<name>Phone Number 1</name>
<script>on mouseUpif there is a stack "Phone Dialer"then dialNumber bg fld id 8else dial bg fld id 8end mouseUp</script>
</part>
<part>
<id>83</id>
<type>field</type>
<visible> <true /> </visible>
<dontWrap> <false /> </dontWrap>
<dontSearch> <false /> </dontSearch>
<sharedText> <true /> </sharedText>
<fixedLineHeight> <true /> </fixedLineHeight>
<autoTab> <false /> </autoTab>
<lockText> <true /> </lockText>
<rect>
<left>7</left>
<top>180</top>
<right>75</right>
<bottom>196</bottom>
</rect>
<style>transparent</style>
<autoSelect> <false /> </autoSelect>
<showLines> <false /> </showLines>
<wideMargins> <false /> </wideMargins>
<multipleLines> <false /> </multipleLines>
<reservedFamily> 0 </reservedFamily>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>right</textAlign>
<font>Palatino</font>
<textSize>10</textSize>
<textStyle>plain</textStyle>
<textHeight>13</textHeight>
<name>Telephone Label</name>
<script></script>
</part>
<part>
<id>20</id>
<type>button</type>
<visible> <true /> </visible>
<reserved5> 0 </reserved5>
<reserved4> 0 </reserved4>
<reserved3> 0 </reserved3>
<reserved2> 0 </reserved2>
<reserved1> 0 </reserved1>
<enabled> <true /> </enabled>
<rect>
<left>297</left>
<top>198</top>
<right>363</right>
<bottom>247</bottom>
</rect>
<style>transparent</style>
<showName> <true /> </showName>
<highlight> <false /> </highlight>
<autoHighlight> <true /> </autoHighlight>
<sharedHighlight> <true /> </sharedHighlight>
<family>0</family>
<titleWidth>0</titleWidth>
<icon>12722</icon>
<textAlign>center</textAlign>
<font>Palatino</font>
<textSize>10</textSize>
<textStyle>plain</textStyle>
<name>Appointments</name>
<script>on mouseUpset cursor to watchput "Appointments with Audio" into theStackgo stack theStack in new window -- ∆get the resultif it = "Cancel" then exit mouseUpif it ≠ empty thengo stack theStack -- ∆if the result ≠ emptythen answer "Can't find stack" && quote & theStack & quote -- ∆end ifend mouseUp</script>
</part>
<part>
<id>22</id>
<type>button</type>
<visible> <true /> </visible>
<reserved5> 0 </reserved5>
<reserved4> 0 </reserved4>
<reserved3> 0 </reserved3>
<reserved2> 0 </reserved2>
<reserved1> 0 </reserved1>
<enabled> <true /> </enabled>
<rect>
<left>360</left>
<top>198</top>
<right>407</right>
<bottom>247</bottom>
</rect>
<style>transparent</style>
<showName> <true /> </showName>
<highlight> <false /> </highlight>
<autoHighlight> <true /> </autoHighlight>
<sharedHighlight> <true /> </sharedHighlight>
<family>0</family>
<titleWidth>0</titleWidth>
<icon>22978</icon>
<textAlign>center</textAlign>
<font>Palatino</font>
<textSize>10</textSize>
<textStyle>plain</textStyle>
<name>Home</name>
<script>on mouseUpset cursor to watchgo homeend mouseUp</script>
</part>
<part>
<id>51</id>
<type>button</type>
<visible> <true /> </visible>
<reserved5> 0 </reserved5>
<reserved4> 0 </reserved4>
<reserved3> 0 </reserved3>
<reserved2> 0 </reserved2>
<reserved1> 0 </reserved1>
<enabled> <true /> </enabled>
<rect>
<left>301</left>
<top>138</top>
<right>401</right>
<bottom>157</bottom>
</rect>
<style>rectangle</style>
<showName> <true /> </showName>
<highlight> <false /> </highlight>
<autoHighlight> <true /> </autoHighlight>
<sharedHighlight> <true /> </sharedHighlight>
<family>0</family>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>center</textAlign>
<font>Palatino</font>
<textSize>12</textSize>
<textStyle>plain</textStyle>
<name>New Card</name>
<script>on mouseUp-- Requires handler: toggleMark-- create a new card and leaving the cursor into the name fieldtoggleNotes falseset lockMessages to truedoMenu "New Card"toggleMark falseselect after text of bg field id 4end mouseUp</script>
</part>
<part>
<id>52</id>
<type>button</type>
<visible> <true /> </visible>
<reserved5> 0 </reserved5>
<reserved4> 0 </reserved4>
<reserved3> 0 </reserved3>
<reserved2> 0 </reserved2>
<reserved1> 0 </reserved1>
<enabled> <true /> </enabled>
<rect>
<left>301</left>
<top>161</top>
<right>401</right>
<bottom>180</bottom>
</rect>
<style>rectangle</style>
<showName> <true /> </showName>
<highlight> <false /> </highlight>
<autoHighlight> <true /> </autoHighlight>
<sharedHighlight> <true /> </sharedHighlight>
<family>0</family>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>center</textAlign>
<font>Palatino</font>
<textSize>12</textSize>
<textStyle>plain</textStyle>
<name>Delete Card</name>
<script>on mouseUp-- Requires handler: deleteCurrentCardif the optionKey is down thendoMenu "Delete Card"exit mouseUpend ifif the number of cards in this bkgnd = 1 thenanswer "Can't delete the last address card." with "OK" -- ∆exit to hyperCardend ifanswer "Delete this address card?" with "Cancel" or "OK" -- ∆if it is "OK" then -- ∆set cursor to watchget number of this cardlock screendoMenu "Delete Card"go card it - 1unlock screenend ifend mouseUp</script>
</part>
<part>
<id>53</id>
<type>button</type>
<visible> <true /> </visible>
<reserved5> 0 </reserved5>
<reserved4> 0 </reserved4>
<reserved3> 0 </reserved3>
<reserved2> 0 </reserved2>
<reserved1> 0 </reserved1>
<enabled> <true /> </enabled>
<rect>
<left>301</left>
<top>92</top>
<right>401</right>
<bottom>111</bottom>
</rect>
<style>rectangle</style>
<showName> <true /> </showName>
<highlight> <false /> </highlight>
<autoHighlight> <true /> </autoHighlight>
<sharedHighlight> <true /> </sharedHighlight>
<family>0</family>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>center</textAlign>
<font>Palatino</font>
<textSize>12</textSize>
<textStyle>plain</textStyle>
<name>Find…</name>
<script>on mouseUp-- Requires handler: findTextglobal AddressFindask "What text do you want to find?" with AddressFind -- ∆if it is empty then exit mouseUpelseput it into AddressFindfindTextend ifend mouseUp</script>
</part>
<part>
<id>54</id>
<type>button</type>
<visible> <true /> </visible>
<reserved5> 0 </reserved5>
<reserved4> 0 </reserved4>
<reserved3> 0 </reserved3>
<reserved2> 0 </reserved2>
<reserved1> 0 </reserved1>
<enabled> <true /> </enabled>
<rect>
<left>301</left>
<top>115</top>
<right>401</right>
<bottom>134</bottom>
</rect>
<style>rectangle</style>
<showName> <true /> </showName>
<highlight> <false /> </highlight>
<autoHighlight> <false /> </autoHighlight>
<sharedHighlight> <false /> </sharedHighlight>
<family>0</family>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>center</textAlign>
<font>Palatino</font>
<textSize>12</textSize>
<textStyle>plain</textStyle>
<name>Show Notes</name>
<script>on mouseUp-- Requires handler: toggleNotes-- hide/show the Notes fieldtoggleNotes (not visible of bkgnd field "Notes")end mouseUp.</script>
</part>
<part>
<id>76</id>
<type>button</type>
<visible> <true /> </visible>
<reserved5> 0 </reserved5>
<reserved4> 0 </reserved4>
<reserved3> 0 </reserved3>
<reserved2> 0 </reserved2>
<reserved1> 0 </reserved1>
<enabled> <true /> </enabled>
<rect>
<left>323</left>
<top>68</top>
<right>349</right>
<bottom>91</bottom>
</rect>
<style>transparent</style>
<showName> <false /> </showName>
<highlight> <false /> </highlight>
<autoHighlight> <true /> </autoHighlight>
<sharedHighlight> <true /> </sharedHighlight>
<family>0</family>
<titleWidth>0</titleWidth>
<icon>20461</icon>
<textAlign>center</textAlign>
<font>Chicago</font>
<textSize>12</textSize>
<textStyle>plain</textStyle>
<name>Prev</name>
<script>on mouseDown-- go to the previous card-- if the shift key is down go to the previously marked cardvisual effect wipe right fastif the shiftKey is down then go previous marked cdelse if the commandKey is down then go first cd of this bgelse go prev cd of this bgend mouseDownon mouseStillDown-- Requires handler: mouseDownmouseDownend mouseStillDown</script>
</part>
<part>
<id>77</id>
<type>button</type>
<visible> <true /> </visible>
<reserved5> 0 </reserved5>
<reserved4> 0 </reserved4>
<reserved3> 0 </reserved3>
<reserved2> 0 </reserved2>
<reserved1> 0 </reserved1>
<enabled> <true /> </enabled>
<rect>
<left>355</left>
<top>68</top>
<right>380</right>
<bottom>91</bottom>
</rect>
<style>transparent</style>
<showName> <false /> </showName>
<highlight> <false /> </highlight>
<autoHighlight> <true /> </autoHighlight>
<sharedHighlight> <true /> </sharedHighlight>
<family>0</family>
<titleWidth>0</titleWidth>
<icon>22126</icon>
<textAlign>center</textAlign>
<font>Chicago</font>
<textSize>12</textSize>
<textStyle>plain</textStyle>
<name>Next</name>
<script>on mouseDown-- go to the next card-- if the shift key is down go to the next marked cardvisual effect wipe right fastif the shiftKey is down then go next marked cdelse if the commandKey is down then go last cd of this bgelse go next cd of this bkgndend mouseDownon mouseStillDown-- Requires handler: mouseDownmouseDownend mouseStillDown</script>
</part>
<part>
<id>93</id>
<type>button</type>
<visible> <true /> </visible>
<reserved5> 0 </reserved5>
<reserved4> 0 </reserved4>
<reserved3> 0 </reserved3>
<reserved2> 0 </reserved2>
<reserved1> 0 </reserved1>
<enabled> <true /> </enabled>
<rect>
<left>346</left>
<top>5</top>
<right>364</right>
<bottom>24</bottom>
</rect>
<style>opaque</style>
<showName> <false /> </showName>
<highlight> <false /> </highlight>
<autoHighlight> <false /> </autoHighlight>
<sharedHighlight> <true /> </sharedHighlight>
<family>0</family>
<titleWidth>0</titleWidth>
<icon>9832</icon>
<textAlign>center</textAlign>
<font>Chicago</font>
<textSize>12</textSize>
<textStyle>plain</textStyle>
<name>Unmark</name>
<script>on mouseUp-- Requires handler: toggleMarktoggleMark not marked of this cardend mouseUp</script>
</part>
<part>
<id>95</id>
<type>field</type>
<visible> <false /> </visible>
<dontWrap> <false /> </dontWrap>
<dontSearch> <true /> </dontSearch>
<sharedText> <true /> </sharedText>
<fixedLineHeight> <true /> </fixedLineHeight>
<autoTab> <false /> </autoTab>
<lockText> <false /> </lockText>
<rect>
<left>0</left>
<top>0</top>
<right>30</right>
<bottom>19</bottom>
</rect>
<style>rectangle</style>
<autoSelect> <false /> </autoSelect>
<showLines> <false /> </showLines>
<wideMargins> <false /> </wideMargins>
<multipleLines> <false /> </multipleLines>
<reservedFamily> 0 </reservedFamily>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>left</textAlign>
<font>Geneva</font>
<textSize>12</textSize>
<textStyle>plain</textStyle>
<textHeight>16</textHeight>
<name>Sort order</name>
<script>on mouseUphide meend mouseUp</script>
</part>
<part>
<id>96</id>
<type>field</type>
<visible> <false /> </visible>
<dontWrap> <false /> </dontWrap>
<dontSearch> <true /> </dontSearch>
<sharedText> <true /> </sharedText>
<fixedLineHeight> <true /> </fixedLineHeight>
<autoTab> <false /> </autoTab>
<lockText> <true /> </lockText>
<rect>
<left>141</left>
<top>0</top>
<right>214</right>
<bottom>19</bottom>
</rect>
<style>rectangle</style>
<autoSelect> <false /> </autoSelect>
<showLines> <false /> </showLines>
<wideMargins> <false /> </wideMargins>
<multipleLines> <false /> </multipleLines>
<reservedFamily> 0 </reservedFamily>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>left</textAlign>
<font>Geneva</font>
<textSize>12</textSize>
<textStyle>plain</textStyle>
<textHeight>16</textHeight>
<name>Name Order</name>
<script>on mouseUphide meend mouseUp</script>
</part>
<part>
<id>103</id>
<type>button</type>
<visible> <true /> </visible>
<reserved5> 0 </reserved5>
<reserved4> 0 </reserved4>
<reserved3> 0 </reserved3>
<reserved2> 0 </reserved2>
<reserved1> 0 </reserved1>
<enabled> <true /> </enabled>
<rect>
<left>336</left>
<top>1</top>
<right>373</right>
<bottom>29</bottom>
</rect>
<style>transparent</style>
<showName> <false /> </showName>
<highlight> <false /> </highlight>
<autoHighlight> <false /> </autoHighlight>
<sharedHighlight> <true /> </sharedHighlight>
<family>0</family>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>center</textAlign>
<font>Chicago</font>
<textSize>12</textSize>
<textStyle>plain</textStyle>
<name></name>
<script>on mouseUp-- Requires handler: toggleMarktoggleMark not marked of this cardend mouseUp</script>
</part>
<part>
<id>105</id>
<type>field</type>
<visible> <true /> </visible>
<dontWrap> <false /> </dontWrap>
<dontSearch> <false /> </dontSearch>
<sharedText> <true /> </sharedText>
<fixedLineHeight> <true /> </fixedLineHeight>
<autoTab> <false /> </autoTab>
<lockText> <true /> </lockText>
<rect>
<left>8</left>
<top>123</top>
<right>76</right>
<bottom>139</bottom>
</rect>
<style>transparent</style>
<autoSelect> <false /> </autoSelect>
<showLines> <false /> </showLines>
<wideMargins> <false /> </wideMargins>
<multipleLines> <false /> </multipleLines>
<reservedFamily> 0 </reservedFamily>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>right</textAlign>
<font>Palatino</font>
<textSize>10</textSize>
<textStyle>plain</textStyle>
<textHeight>13</textHeight>
<name>State Label</name>
<script></script>
</part>
<part>
<id>7</id>
<type>field</type>
<visible> <false /> </visible>
<dontWrap> <false /> </dontWrap>
<dontSearch> <false /> </dontSearch>
<sharedText> <false /> </sharedText>
<fixedLineHeight> <true /> </fixedLineHeight>
<autoTab> <true /> </autoTab>
<lockText> <false /> </lockText>
<rect>
<left>7</left>
<top>64</top>
<right>285</right>
<bottom>247</bottom>
</rect>
<style>scrolling</style>
<autoSelect> <false /> </autoSelect>
<showLines> <false /> </showLines>
<wideMargins> <false /> </wideMargins>
<multipleLines> <false /> </multipleLines>
<reservedFamily> 0 </reservedFamily>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>left</textAlign>
<font>Palatino</font>
<textSize>12</textSize>
<textStyle>plain</textStyle>
<textHeight>16</textHeight>
<name>Notes</name>
<script>on enterInField-- Requires handler toggleNotestoggleNotes (not visible of bkgnd field "Notes")end enterInField</script>
</part>
<content>
<layer>background</layer>
<id>75</id>
<text>City</text>
</content>
<content>
<layer>background</layer>
<id>80</id>
<text>Company</text>
</content>
<content>
<layer>background</layer>
<id>79</id>
<text>Street</text>
</content>
<content>
<layer>background</layer>
<id>82</id>
<text>Zip Code</text>
</content>
<content>
<layer>background</layer>
<id>83</id>
<text>Telephone</text>
</content>
<content>
<layer>background</layer>
<id>96</id>
<text>last word</text>
</content>
<content>
<layer>background</layer>
<id>95</id>
<text>1</text>
</content>
<content>
<layer>background</layer>
<id>81</id>
<text>Name</text>
</content>
<content>
<layer>background</layer>
<id>105</id>
<text>State</text>
</content>
<name>Body</name>
<script>∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞Script from background "Body" of Addresses StackVersion 2.1THE MESSAGE HANDLERS IN THIS SCRIPT:arrowKey,closeCard,deleteCurrentCard,dialNumber,enterKey,exportText,findText,importText,importTextFile,ImportTextFromNewStack,ImportTextFromOldStack,printReport,resetAPButtons,returnKey,openCard,sortCards,toggleMark,toggleNotes,whichStackVersion,writeExportedText,THE FUNCTION HANDLERS IN THIS SCRIPT:executeFind,getLabelContents,lastHCItem,substituteChar,swapItemDelimiter,theFields"--∆" indicates strings which will need localization∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞on openCard-- Requires handler: toggleMarktoggleMark the marked of this cardpass openCardend openCardon arrowKey whichKeyif (((whichKey is "left") or (whichKey is "Right")) and (the shiftKey is down))then go next marked cardelse pass arrowKeyend arrowKeyon closeCardtoggleNotes falsepass closeCardend closeCard----- Sort Handler ------------------------------------------------on sortCards sortFieldput "sort cards of this bg international" into sortBodyif sortField is "Name" thendo sortBody && "by" && bg field "Name Order" && ¬"of bg field" && quote & sortField & quoteelse do sortBody && "by bg field" && quote & sortField & quoteend sortCards----- Find Handlers ------------------------------------------------on findText-- Requires handler: toggleNotesglobal AddressFindif AddressFind is empty then exit findTextfind AddressFindif the result is NOT empty thenbeepanswer "“" & AddressFind & "” was not found." -- ∆exit findTextend ifif the short name of the foundField is "Notes" thenif not visible of bg fld "Notes" thenset cursor to watchtoggleNotes truefind AddressFind in bg fld "Notes"end ifelseif visible of bg fld "Notes" thenset cursor to watchtoggleNotes falsefind AddressFind in the foundFieldend ifend ifend findTexton returnKeyif msg is empty thenif executeFind() thenpass returnKeyend ifelse pass returnKeyend returnKeyon enterKeyif msg is empty thenif executeFind() thenpass enterKeyend ifelse pass enterKeyend enterKeyfunction executeFind-- Requires handler: findText-- if the cursor is not in a field or in the message box, then-- assume they want to find the text again.global AddressFindif (AddressFind is not empty) and (the selectedField is empty) thenfindTextreturn FALSEelse return TRUEend executeFind----- Misc Handlers ------------------------------------------------on toggleMark isMarked-- 'dog ear' the card to reflect its 'marked' statusif isMarked thenhide bg btn "Unmark"set the marked of this card to trueelseshow bg btn "Unmark"set the marked of this card to falseend ifend toggleMarkon toggleNotes visStatus-- shows and hides the notes fieldlock screenset hilite of bg btn id 54 to visStatusset the visible of bg fld "Notes" to visStatusif visStatus then -- show it-- change the name of the btn to hide notes fldset the name of bg btn id 54 to "Hide Notes" -- ∆put "wipe left fast" into theVisEffectselect after text of bg fld "Notes"else -- hide it-- change the name of the btn to hide notes fieldset the name of bg btn id 54 to "Show Notes" -- ∆put "wipe right fast" into theVisEffectend ifunlock screen with visual effect theVisEffectend toggleNoteson printReportif the shiftKey is up then -- print all the cardsput true into printAllCardsput "addresses" into phrase -- ∆else -- print only the marked cardsput false into printAllCardsput "marked cards" into phrase -- ∆end ifanswer "Print all" && phrase && ¬"as a name and address list or as an address book?" ¬with "Cancel" or "List" or "Book" -- ∆if it is "Cancel" then exit printReport -- ∆else if it is "List" then put "Name and Address List" into theTemplate -- ∆else if it is "Book" then put "Address Book" into theTemplate -- ∆open report printing with template theTemplate -- ∆go first card of bg "Body"if printAllCards then print (number of cards in bg "Body") cardselse print marked cardsclose printingend printReporton dialNumber phoneNumber-- Requires handler: dial from the Phone Stack-- dial the phone using the Phone Dialer stackset cursor to watchif phoneNumber is empty then exit dialNumberpush card -- remember where we arelock screen-- the 'dial' handler is in the 'Phone Dialer' stackif there is a stack "Phone Dialer" then -- ∆go stack "Phone Dialer" -- ∆dial phoneNumber -- dial the numberelse answer "The number could not be dialed, because the Phone Dialer stack cannot be found." -- ∆pop card -- return to where we wereunlock screenend dialNumber----- Label Handler -------------------------------function getLabelContents-- Assembles information for print labelsif bg fld "Company" is empty thenreturn bg fld "Name" & return & bg fld "Street" & ¬return & bg fld "City" &", "& bg fld "State" && bg fld "Zip"else return bg fld "Name" & return & bg fld "Company" & ¬return & bg fld "Street" & return & bg fld "City" & ¬", " & bg fld "State" && bg fld "Zip"end getLabelContents----- Import Text Operations --------------------------------- text files to be imported into the stack need to be in a specific-- format: chunks of information (such as Name, Company,-- etc.) should be separated by tabson importText-- Requires handlers: importTextFromStack,importTextFile-- import text from a HyperCard 1.x or 2.x Address stack or from a text fileanswer "Import text from a text file or from an Address stack" ¬&& "(that shipped with a version of HyperCard)?" ¬with "Cancel" or "Stack" or "Text File" -- ∆if it is "Cancel" then exit importText -- ∆if it is "Stack" then whichStackVersion -- ∆else ImportTextFileend importTexton ImportTextFile fileName-- Requires handler: toggleMark, deleteCurrentCard-- Requires function handler: theFields, SubstituteChar-- import text from a text file stored in the correct formatif fileName is empty thenanswer file "Import text from what file?" of type "TEXT" -- ∆if the result is "Cancel" or it is empty then exit ImportTextFileput it into fileNameend ifput theFields() into fieldListset cursor to busygo last card of bg "Body" -- adds the new cards to the end of the stack -- ∆set lockRecent to trueset lockMessages to trueopen file fileNameput false into exitLooprepeat until exitLoopif the mouseClick thenanswer "Stop importing text?" with "No" or "Yes" -- ∆if it is "Yes" then exit repeat -- ∆end ifset cursor to busydoMenu "New Card"toggleMark falserepeat with fieldNum = 1 to (number of items in fieldList - 1)read from file fileName until tabif it is empty then -- out of textdeleteCurrentCard -- delete the stragglerput true into exitLoopexit repeatend ifif last char of it is tab then delete last char of itdo "put it into" && item fieldNum of fieldListend repeatif exitLoop then exit repeatread from file fileName until returnput SubstituteChar("…", return, it) into itdo "put it into" && item fieldNum + 1 of fieldListend repeatclose file fileNameset lockRecent to falseset lockMessages to falseend ImportTextFileon whichStackVersion-- Requires handler: importTextFile-- Requires function handler: SubstituteChar, SwapItemDelimiter-- import text from the HyperCard 1.x Address stack.answer file "Import text from which Address stack?" of type "STAK" -- ∆if it is empty or the result is "Cancel" then exit to hyperCardput it into exportStackput exportStack into fileNameput SwapItemDelimiter(colon) into oldDelimiterdelete last item of fileNameset the itemDelimiter to oldDelimiterput fileName & ":HCAddressExportHC" into fileNameput the long name of this stack into importStackpush cdset cursor to busyset lockMessages to trueset lockRecent to truego stack exportStack-- export all the other stacks data to a file then import into this stack -- ∆put number of bg fields into numBgFieldsif numBgFields = 0 thenanswer "There are no background fields from which to export data!" -- ∆exit to hyperCardend if-- version 1.2.5 or earlierif (there is a bg fld "Name and Address") and ¬(there is a bg fld "Phone Number") and ¬(there is a bg fld "Date") thenImportTextFromOldStack fileNameelse if there is a bg "Body" and hasCorrectFlds() thenImportTextFromNewStack fileName -- version 2.0 or laterelseanswer "This stack has been modified or was" && ¬"not shipped with a version of HyperCard."exit to HyperCardend ifgo to importStackunlock screenImportTextFile fileName -- now import the fileopen file fileNamewrite empty to file fileName -- empty out the temp fileclose file fileNamepop cdend whichStackVersionfunction hasCorrectFldsput "Name,Company,Street,Zip,Phone 1,Phone 2,Phone 3,Phone 4,Notes" into listrepeat with i = 1 to 9if there is not a bg fld (item i of list) then return "False"end repeatput "false" into itExistsif (there is a bg fld "CityState") then put "true" into itExistsif (there is a bg fld "City") and (there is a bg fld "State")then put "true" into itExistsif itExists is "false" then return "false"return "True"end hasCorrectFldson ImportTextFromNewStack fileName-- collects from version 2.0 or later Addresses Stacksopen file fileNamerepeat the number of cds of bg "Body"set cursor to busyput bg fld "Name" into theName -- nameput bg fld "Company" into theCompany -- companyput bg fld "Street" into theStreet -- streetif there is a bg fld "CityState" then -- version 2.0v2get bg fld "CityState"put item 1 of it into theCity -- cityput item 2 of it into theState -- stateif char 1 of theState is space thendelete char 1 of theStateend ifelse -- version 2.1put bg fld "City" into theCity -- cityput bg fld "State" into theState -- stateend ifput bg fld "Zip" into theZip -- Zip Codeput empty into thePhonesrepeat with i = 1 to 4put bg fld ("Phone" && i) & tab after thePhonesend repeatput bg fld "Notes" into theNotes -- notes fieldwrite theName & tab & theCompany & tab & theStreet & tab & ¬theCity & tab & theState & tab & theZip & tab & thePhones & ¬theNotes & return to file fileNamego next cd of bg "Body"end repeatclose file fileNameend ImportTextFromNewStackon ImportTextFromOldStack fileName-- collects from version 1.2.5 or earlier Address Stacksopen file fileNamelock screenrepeat the number of cardsset cursor to busyput bg fld "Name and Address" into anAddressput the number of lines in anAddress into numLinesrepeat with lineNdx = 1 to the number of lines in anAddressif line lineNdx of anAddress = empty then exit repeatend repeatput empty into theNotesif lineNdx ≠ numLines thenif lineNdx > 4 thenput line lineNdx to 32000 of anAddress & return into theNotesdelete line lineNdx to 32000 of anAddressput word 1 to 2000 of anAddress into anAddress -- strip blank linesput the number of lines in anAddress into numLinesend ifend ifput line 1 of anAddress into theName -- Nameif (numLines - 2) > 1 then -- if there's a third to last line, it's companyput line (numLines - 2) of anAddress into theCompanyif (numLines - 2) > 2 thenput return & line 2 to (numLines - 3) of anAddress & return ¬after theNotes -- department?end ifelse put empty into theCompanyif numLines = 2 then put line 2 of anAddress into theStreetelse if (numLines - 1) > 1 then -- if there's a second to last line, it's streetput line (numLines - 1) of anAddress into theStreet -- streetelse put empty into theStreetput empty into thePhonesrepeat with phoneNdx = 1 to 4put line phoneNdx of bg fld "Phone Number" & tab after thePhonesend repeatif bg fld "Date" ≠ empty thenput bg fld "Date" after theNotes -- move the date to the notes fieldend ifput SubstituteChar(return, "…", theNotes) into theNotes -- ∆put empty into theCityput empty into theStateput empty into theZipif numLines > 2 thenput line numLines of anAddress into lastLineput last word of lastLine into lastWordif lastWord ≠ empty thenif offset(lastWord, "/-+") = 0 thenif value(lastWord) is a number thenput lastWord into theZipdelete last word of lastLineend ifend ifend ifput item 1 of lastLine into theCityput word 1 of item 2 of lastLine into theStateend ifwrite theName & tab & theCompany & tab & theStreet & tab & ¬theCity & tab & theState & tab & theZip & tab & thePhones & ¬theNotes & return to file fileNamego next cardend repeatclose file fileNameend ImportTextFromOldStack----- Export Text Operations -------------------------------------on exportText-- Requires handler: writeExportedText-- Requires function handler: lastHCItem-- if shiftKey is down use only the marked cardsif the shiftKey is down thenput false into useAllCardsput "from marked cards" & space into prompt -- ∆put number of marked cards into numCardselseput true into useAllCardsput empty into promptput number of cards in bg "Body" into numCardsend ifask file "Export text" && prompt & "to the file:" with "Addresses Text File" -- ∆if the result is "Cancel" or it is empty then exit exportTextput it into fileNamewriteExportedText numCards, useAllCards, fileNameif numCards = 1 then put "card" into info -- ∆else put "cards" into info -- ∆answer "The text from" && numCards && info && ¬"was exported to the new file “" & lastHCItem(":",fileName) & "”." -- ∆end exportTexton writeExportedText numCards, useAllCards, fileName-- Requires function handler: theFieldslock screenif useAllCards then go card 1 of bg "Body"else go first marked cardput theFields() into fieldListopen file fileNamerepeat with currentCard = 1 to numCardsset cursor to busyput empty into theTextrepeat with i = 1 to (number of items in fieldList - 1)put value of (item i of fieldList) & tab after theTextend repeatput SubstituteChar(return,"…", value of (item i + 1 of fieldList)) & ¬tab & return after theTextwrite theText to file fileNameif not useAllCards then go next marked cardelse go next card of this bgend repeatclose file fileNameunlock screenend writeExportedText----- Utility Handlers --------------------------------------------on deleteCurrentCardlock screenpush prev cddoMenu "Delete Card"pop cdunlock screenend deleteCurrentCardfunction LastHCItem theDelim,theText-- returns the portion of <theText> that follows the last <delim>put SwapItemDelimiter(theDelim) into oldDelimput last item of theText into theResultset the itemDelimiter to oldDelimreturn theResultend LastHCItemfunction SubstituteChar origChar, newChar, theText-- returns ‘theText’ with ‘newChar’ substituted for all instances of ‘origChar’repeatput Offset(origChar, theText) into charPosif charPos = 0 then return theTextput newChar into char charPos of theTextend repeatend SubstituteCharfunction SwapItemDelimiter newDelim-- change the itemDelimiter, return the old delimiter for later resettingput the itemDelimiter into oldDelimset the itemDelimiter to newDelimreturn oldDelimend SwapItemDelimiter----- Data Handlers ----------------------------------------------function theFieldsreturn "bg fld id 4,bg fld id 97," & ¬"bg fld id 6,bg fld id 98,bg fld id 99," & ¬"bg fld id 104,bg fld id 8,bg fld id 100," & ¬"bg fld id 101,bg fld id 102,bg fld id 7"end theFields</script>